<template>
  <div class="nav-bar">
    <toast ref="toast"/>
    <div class="back"></div>
    <div class="title">校园闲置</div>
    <div class="release" @click="to_release">
      <img src="../../assets/img/Mall/release/tianjiazengjiajia.svg" alt="">
    </div>
  </div>
</template>

<script>
import Toast from '../../components/Toast/Toast.vue'

export default {
  components: { Toast },
  name: '',
  data () {
    return {
      
    }
  },
  computed:{
    isLogin(){
      return this.$store.getters.isLogin
    },
  },
  methods:{
  to_release(){
    if(!this.isLogin){
      let msg = '登录后可发布商品'
      let color = 'DarkOrange'
      this.$refs.toast.show(msg,color)
      return 
    } else{
      this.$router.push('/release')
    }
    
  }
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .nav-bar{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    width: 100%;
    height: 44px;
    background-color: #ff8198;
    color: #fff;
    text-align: center;
    line-height: 44px;
    z-index: 1;
  }
  .back,.release{
    width: 60px;
  }
  .release img{
    width: 45px;
  }
  .title{
    flex: 1;
  }
</style>